Once Upon an Algorithm: How Stories Explain Computing by Martin Erwig

Once Upon an Algorithm: How Stories Explain Computing by Martin Erwig
Author: Martin Erwig [Erwig, Martin]
Language: eng
Format: epub
Tags: Computers, Computer Science, Programming, Algorithms, Mathematics, General
ISBN: 9780262036634
Google: 95IwDwAAQBAJ
Publisher: MIT Press
Published: 2017-08-11

That Doesn’t Sound Right


The language for music notation can be defined by a fairly simple grammar. But even for such a simple language it is not clear which grammar rules to use. One problem that can plague a language is that of ambiguity, which means that one sentence can have more than one meaning. Ambiguity can creep into a sentence in two different ways. First, the basic words or signs of a language can be ambiguous, a phenomenon called lexical ambiguity (see chapter 3). Second, a particular combination of words in a sentence can be ambiguous, even though the individual words themselves are not. This is called grammatical ambiguity. Consider, for example, the sentence “Bob knows more girls than Alice.” It could mean that Bob knows more than one girl, or it could mean that he knows more girls than Alice does.

A grammatical ambiguity occurs when a grammar can generate more than one syntax tree for a given sentence. To continue with the music example, consider the following part of “Over the Rainbow.” Curiously, the score does not contain any bars, which causes this sentence to be ambiguous, since it is not clear which note, the first or the second, should be emphasized when playing it.